# -*- coding:utf-8 -*-
from sqlalchemy import Column, Integer, String
from core.curd import Base, TimestampMixin
from pydantic import Field, BaseModel


class SysClient(Base, TimestampMixin):
    """
    测试表
    """
    __tablename__ = 'sys_client'

    id = Column(Integer, nullable=False, autoincrement=True, primary_key=True, comment='id')
    name = Column(String(100), comment='标题')
    path = Column(String(100), comment='路径')
    sort = Column(Integer, comment='排序')
    appid = Column(String(100), comment='应用ID')
    appkey = Column(String(100), comment='应用密钥')
    status = Column(Integer, comment='状态  0：停用   1：正常')
    version = Column(String(32), comment='版本号')
    deleted = Column(Integer, comment='删除标识  0：正常   1：已删除')
    creator = Column(Integer, comment='创建者')
    updater = Column(Integer, comment='更新者')


class CreateSysClient(BaseModel):
    name: str = Field(comment='标题', max_length=100)
    path: str = Field(comment='路径', max_length=100)
    appid: str = Field( comment='应用ID', min_length=16, max_length=64)
    appkey: str = Field(comment='应用密钥', min_length=16, max_length=64)
    version: str = Field( comment='版本号',min_length=1, max_length=16)
    sort: int = Field(comment="排序", default=0)
    status: str = Field(comment="状态 0 停用 1正常", min_length=1, max_length=2)
    remark: str = Field(comment="备注", max_length=200)


class UpdateSysClient(BaseModel):
    id: int = Field(comment='id')
    name: str = Field(comment='标题', max_length=100)
    path: str = Field(comment='路径', max_length=100)
    appid: str = Field( comment='应用ID', min_length=16, max_length=64)
    appkey: str = Field(comment='应用密钥', min_length=16, max_length=64)
    version: str = Field( comment='版本号',min_length=1, max_length=16)
    sort: int = Field(comment="排序", default=0)
    status: str = Field(comment="状态 0 停用 1正常", min_length=1, max_length=2)
    remark: str = Field(comment="备注", max_length=200)